package com.xh.bussiness.thirdapi.feihong.controller;

import com.xh.bussiness.thirdapi.feihong.service.IFeihongService;
import com.xh.core.annotation.ExcludeLoginTokenIntercept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Pitt Cheung
 * @date 2021/6/15 18:54
 */
@RestController
@RequestMapping("/fhApi")
public class FeihongApiController {

    @Autowired
    private IFeihongService feihongService;

    /**
     * 同步教师信息
     * @return
     */
    @ExcludeLoginTokenIntercept
    @RequestMapping("/syncTeacher")
    public String syncTeacher() {
        // 从2000年1月1日之后的数据
        try {
            feihongService.importTeacher();
            return "同步成功!";
        } catch (Exception e) {
            e.printStackTrace();
            return "同步失败";
        }
    }

    /**
     * 同步教师信息
     * @return
     */
    @ExcludeLoginTokenIntercept
    @RequestMapping("/syncSchool")
    public String syncSchool() {
        // 从2000年1月1日之后的数据
        try {
            feihongService.importSchool();
            return "同步成功!";
        } catch (Exception e) {
            e.printStackTrace();
            return "同步失败";
        }
    }
}
